package miracle.joker.design.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class MovieLibrary implements Iterable<Movie> {
    private List<Movie> movies = new ArrayList<>();

    public void addMovie(Movie movie) {
        movies.add(movie);
    }

    public void removeMovie(Movie movie) {
        movies.remove(movie);
    }

    @Override
    public Iterator<Movie> iterator() {
        return new MovieIterator(movies);
    }
}
